// pages/examine/examine.js
const {
  get,
  post
} = require('../../request/index');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    auditRemark: "",
    auditMemberSign: "",
    auditStatus: "3",
    obj: {},
    formConfig: [

      {
        label: '申请动火单位',
        prop: 'addDept',
      },
      {
        label: "作业单位",
        prop: "operateDept",
      },
      {
        label: "动火作业点",
        prop: "point",
      },
      {
        label: '作业内容',
        prop: 'content',
      },

      {
        label: '动火人1',
        prop: 'oneId',
        type: 'multiDropDown',

        hidden: 'look',
        net: {
          url: '/app/asysrole/getAllMember',
          method: 'post',
          data: {
            mineId: true,

          },
          key: 'memberId',
          value: 'nickName'
        }
      },

      {
        label: "证件号1",
        prop: "oneNo",

      },
      {
        label: '特种作业类别1',
        prop: 'oneSpecial',
      },
      {
        label: '动火人2',
        prop: 'secondId',
        type: 'multiDropDown',

        hidden: 'look',
        net: {
          url: '/app/asysrole/getAllMember',
          method: 'post',
          data: {
            mineId: true,

          },
          key: 'memberId',
          value: 'nickName'
        }
      },

      {
        label: "证件号2",
        prop: "secondNo",
      },
      {
        label: '特种作业类别2',
        prop: 'secondSpecial',
      },
      {
        label: '动火监护人',
        prop: 'guardianId',
        type: 'multiDropDown',

        hidden: 'look',
        net: {
          url: '/app/asysrole/getAllMember',
          method: 'post',
          data: {
            mineId: true,

          },
          key: 'memberId',
          value: 'nickName'
        }
      },

      {
        label: '动火等级',
        prop: 'level',
      },
      {
        label: '动火开始时间',
        prop: 'startTime',
        type: "dateTime",

      },
      {
        label: '动火结束时间',
        prop: 'endTime',
        type: "dateTime",

      },

      {
        label: '可燃气体含量',
        prop: 'gas',

      },
      {
        label: "有毒气体含量",
        prop: "toxicGas",

      },


      {
        label: "动火设备内部构件清理干净，蒸汽吹扫或水洗合格，达到动火条件。",
        prop: "a",
        type: 'boxbl',
        checked: true,
      },
      {
        label: "在井口、井筒和主要进风巷内动火作业时，必须撤出井下和回风侧所有作业人员。",
        prop: "b",
        type: 'boxbl',
        checked: true,
      },
      {
        label: "动火点周围（最小半径15米）的下水井、地漏、地沟、电缆沟等已清除易燃物，并已采取覆盖、铺砂、水封等手段进行隔离。",
        prop: "c",
        type: 'boxbl',
        checked: true,
      },
      {
        label: "距动火点30米内严禁排放各类可燃气体，15米内严禁堆放各类可燃液体。动火点10米范围内及动火点下部区域严禁同时进行可燃溶剂清洗和喷漆等作业。",
        prop: "d",
        type: 'boxbl',
        checked: true,
      },
      {
        label: "高处作业应采取防火花飞溅措施。",
        prop: "e",
        type: 'boxbl',
        checked: true,
      },
      {
        label: "电焊回路线应该接在焊件上，把线不得穿过下水井或与其他设备搭线。",
        prop: "f",
        type: 'boxbl',
        checked: true,
      },
      {
        label: "乙炔瓶应直立放置，氧气瓶与乙炔气瓶间距不应小于5米，二者与动火点明火或其他能源间距不应小于10米",
        prop: "g",
        type: 'boxbl',
        checked: true,
      },
      {
        label: "现场配备灭火器",
        prop: "h",
        pj: 'pj',
        type: "number"
      },
      {
        label: "铁锹",
        prop: "q",
        pj: 'pj',
        type: "number"
      },
      {
        label: "现场是否配备灭火器/铁锹",
        prop: "i",
        type: 'boxbl',
        checked: true,
      },

      {
        label: "在受限空间内进行动火作业，临时用电作业时，不得同时进行刷漆、喷漆作业或使用可燃溶剂清洗等其他可能散发易燃气体、易燃液体作",
        prop: "j",
        type: 'boxbl',
        checked: true,
      },

      {
        label: "危害识别及其他补充措施。",
        prop: "k",
        type: 'boxbl',
        checked: true,
      }


    ],

  },
  onChangeradio(event) {
    this.setData({
      auditStatus: event.detail,
    })
  },
  onChange(e){
    this.setData({
      auditRemark: e.detail,
    })
  },
  sbm() {
    let {
      obj,
      auditRemark,
      auditMemberSign,
      auditStatus
    } = this.data;
    let prolist = wx.getStorageSync('prolist') == '' ? wx.getStorageSync('prolist') : JSON.parse(wx.getStorageSync('prolist'))
if(auditStatus==4){
  post(`/app/fireFlow/update`, {
    flowId: obj.flowId,
    auditMemberId: prolist.userid,
    auditStatus:auditStatus,
    auditMemberSign:auditMemberSign,
    auditRemark:auditRemark,
    mineId:prolist.mineId
  }).then(res=>{
    wx.navigateBack({ 
      delta: 1
    });
  })
}else{
  post(`/app/flowDetail/update`, {
    flowId: obj.flowId,
    auditMemberId: prolist.userid,
    auditStatus:auditStatus,
    auditMemberSign:auditMemberSign,
    auditRemark:auditRemark,
    mineId:prolist.mineId
  }).then(res=>{
    wx.navigateBack({ 
      delta: 1
    });
  })
}
   
  },
  canvasChang(e) {
    console.log(e.detail);
    this.setData({
      auditMemberSign:e.detail
    })
  },

  topJson(e) {
    console.log(e);
    let list = e.split(',');

    return `${list[0]}瓶,${list[1]}把`
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let o = options.obj ? JSON.parse(options.obj) : {}
    this.setData({
      obj: {
        ...o
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})